home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15266 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.trcinc.com!usenet
  2. From: Rich Paul <rpaul@trcinc.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: copy ctor for abstract classes?
  5. Date: Wed, 03 Apr 1996 10:21:34 -0500
  6. Organization: Technical Resource Connection
  7. Message-ID: <3162977E.5236@trcinc.com>
  8. References: <4jpcj1$229@doc.zippo.com>
  9. NNTP-Posting-Host: bajor-le1.trcinc.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB2 (WinNT; I)
  14.  
  15. Clarence, Chiang wrote:
  16. > In article <4jk8kg$e9h@darkstar.UCSC.EDU>, ray@cse.ucsc.edu says...
  17. > >
  18. > >Should an abstract base class have a copy constructor?
  19. > >
  20. > >Ray
  21. > >
  22. > Well, I don't think so. Since an abstract base class is a class that define an
  23. > interface. It generally does not have any data member so usually there is no
  24. > need for an abstract base class to have a copy ctor.
  25.  
  26. if it DOES have any data, though, it should have a 
  27. copy constructor ... otherwise if these members are 
  28. private, there will be no way to initialize them.
  29.  
  30. The rule of thumb for copy constructors and 
  31. assignment operators that I use is generally if 
  32. there is a non-trivial destructor, there should be 
  33. a copy constructor.
  34.  
  35. Furthermore, if there is a copy constructor, there 
  36. should be an assignment operator.
  37.